Behavioral Interface Contracts for Java (Rice University CS TR00-366)

نویسندگان

  • Robert Bruce Findler
  • Matthias Felleisen
چکیده

Programs should consist of off-the-shelf, interchangeable, black-box components that are produced by a network of independent software companies. These components should not only come with type signatures but also with contracts that describe other aspects of their behavior. One way to express contracts is to state preand postconditions for externally visible functions. These preand post-conditions should then be validated during evaluation or possibly even during compilation. If a function call fails to satisfy its contract, the run-time system should blame the faulty program component. Behavioral contracts in the form of assertions are well-understood in the world of procedural languages. Their addition to class and interface hierarchies in object-oriented programming languages, however, raises many new and interesting questions. The most complicating factor is that objects can pass between components and trigger callbacks. Another problem is that object-oriented languages allow objects to satisfy several interfaces at once. In this paper, we analyze existing approaches to adding contracts to class-based languages and show how they blame the wrong component in certain situations for breach of contract. We then present a conservative extension of Java that allows programmers to specify method contracts in interfaces. The extension is a compromise between a consistent enforcement of contracts and language design concerns. In the future, we plan to clarify the relationship between contracts and contract violations with a rigorous analysis. 1 Contracts and Assertions Beugnard, Jézéquel, Plouzeau, and Watkins [1] suggest that software components should come with contracts. They describe four levels of contracts: 1. syntactic contracts (type systems), 2. behavorial contracts (invariants, preand post-conditions), 3. synchronization contracts, and 4. quality of service contracts. Type systems and other syntactic contracts for components have been studied extensively in object-oriented, functional, and higher-order contexts [2, 10, 16]. Behavioral contracts have been studied in procedural contexts [11, 19, 20, 25, 26]. Behavioral contracts have also been added to object-oriented languages [4, 9, 12, 13, 14, 21, 22, 24]. Adding behavioral contracts to object-oriented languages, however, is subtle. Each of the referenced systems fails

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Frontal Solutions: an Information Technology Transfer to Abstract Mathematics

1. Clifton, C., G. Leavens, C. Chambers, T. Millstein, 2000. MultiJava: Modular Open Classes and Symmetric Multiple Dispatch for Java. OOPSLA’00, Minneapolis, Minnesota, October 2000, ACM Press, New York, 130-145. http://www.cs.iastate.edu/~cclifton/multijava/papers/TR00-06.pdf 2. Findler, R., M. Flatt, 1999. Modular Object-Oriented Programming with Units and Mixins. ACM SIGPLAN International C...

متن کامل

Object-oriented Programming Languages Need Well-founded Contracts

Over the past few years, the notion of building software from components has become popular again. The goal is to produce systems by adapting and linking off-the-shelf modules from a pool of interchangeable components. To turn this idea into reality, the formal descriptions of software components need to specify more than the type signatures of their exported services. At a minimum, they should...

متن کامل

Extracting Functional and Non-functional Contracts from Java Classes and Enterprise Java Beans

We explore possibility of manual and automated contract extraction from Java classes and Enterprise Java Beans. Contracts are extended component interfaces that are defined using Contract Definition Language. They describe functional and non-functional properties. We examine how to extract hidden contracts and express them formally,modeling software components as abstract machines, hoping to ac...

متن کامل

Specifying and Checking Method Call Sequences in JML

In a pre and postconditions style specification, it is difficult to specify allowed sequences of method calls, often called protocols. However, the protocols are essential properties of reusable object-oriented classes and application frameworks, and the approaches based on the pre and postconditions, such as design by contracts (DBC) and formal behavioral interface specification languages (BIS...

متن کامل

Automatic Detection to the Behavioral Conflict in AOP Application Based on Design by Contract

Behavioral conflict is one of the key issues in the practical application of AOP (Aspect-Oriented Programming) technology. Based on the ideas of design by contract and behavioral subtyping, we propose an approach that detects the behavioral conflict automatically at runtime. Use Java annotation to describe the contracts of the base program and aspect code, then extract these contracts through t...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2000